package com.example.androidtest;

import android.os.Bundle;
import android.support.app.FragmentTabHost;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.TextView;

import com.example.app.R;

/*public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       // requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);  
        setContentView(R.layout.activity_main);
       // getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_view);  
        //ViewStub mViewStub = (ViewStub)findViewById(R.id.viewStub); 
        //mViewStub.setLayoutResource(R.layout.merge_stub);
       // mViewStub.inflate();
        TextView text=(TextView) findViewById(R.id.Text);
        text.setText(Test.getTest(this));
        
        Test.print(this);
    }
}*/

public class MainActivity2 extends FragmentActivity {  
	  
    private FragmentTabHost mTabHost = null;;  
    private View indicator = null;  
  
    @Override  
    protected void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.tabhost_test);  
        mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);  
        mTabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent/*R.id.realtabcontent*/);  
        // 添加tab名称和图标  
        indicator = getIndicatorView("我的联系人");  
        mTabHost.addTab(mTabHost.newTabSpec("myContact")  
                .setIndicator(indicator), FirstFragment.class, null);  
  
        indicator = getIndicatorView("陌生人");  
        mTabHost.addTab(  
                mTabHost.newTabSpec("stranger").setIndicator(indicator),  
                SecondFragment.class, null);  
  
        indicator = getIndicatorView("常联系人");  
        mTabHost.addTab(  
                mTabHost.newTabSpec("alwaysContact").setIndicator(indicator),  
                ThirdFragment.class, null);  
    }  
  
    private View getIndicatorView(String name) {  
        View v = getLayoutInflater().inflate(R.layout.fragment_test, null);  
        TextView tv = (TextView) v.findViewById(R.id.testId);  
        tv.setText(name);  
        return v;  
    }  
  
    @Override  
    protected void onDestroy() {  
        // TODO Auto-generated method stub  
        super.onDestroy();  
        mTabHost = null;  
    }  
}
